package shuaihui;

public class shuaihui66 {
	public static void main(String[] args) {
		Car c = new Car();
		c.drive();
		Motorcycle m = new Motorcycle();
		m.drive();
		HandTractor h = new HandTractor();
		h.drive();
		CompactCar c1 = new CompactCar();
		c1.drive();
		System.out.println("下是类的多态实");
		Car moto = new Motorcycle();
		moto.drive();
		Car hand = new HandTractor();
		hand.drive();
		Car com = new CompactCar();
		com.drive();
	}
}

class Car {

	public void drive() {
		System.out.println("车");
	}
}

class Motorcycle extends Car {
	public void drive() {
		System.out.println("单车");
	}
}

class HandTractor extends Car {
	public void drive() {
		System.out.println("洒水车");
	}
}

class CompactCar extends Car {
	public void drive() {
		System.out.println("轿车");
	}
}
